package com.neuedu.controller.user;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.neuedu.factory.ClassFactory;
import com.neuedu.service.DeptTypeService;
import com.neuedu.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "DelUserServlet", urlPatterns = "/his/deluser")
public class DelUserServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        Object[] objs = new Object[]{id};
        ObjectMapper om = new ObjectMapper();
        UserService us = (UserService) ClassFactory.createObj("UserService");
        int flag = us.deltype(objs);
        String rs = "";
        if (flag >= 1) {
            rs = "true";
        } else {
            rs = "false";
        }
        System.out.println("rs:" + rs);
        response.getWriter().append(rs);
    }
}
